import { defineStore } from 'pinia';
import { localStorage } from '@/utils/storage';
import { goodsList,brandList,onDelete,categoryList } from '@/api/product';
const useProductStore = defineStore({
  id: 'product',
  state: (): any => ({}),
  actions: {
    getGoodsList(data:any){
      return new Promise((resolve, reject) => {
        goodsList(data)
        .then(res => {
          resolve(res);
        })
        .catch(error => {
          reject(error);
        });
      })
      
    },
    getBrandList(){
      return new Promise((resolve, reject) => {
        brandList()
        .then(res => {
          resolve(res);
        })
        .catch(error => {
          reject(error);
        });
      })
    },
    onDelete(data:any){
      return new Promise((resolve, reject) => {
        onDelete(data)
        .then(res => {
          resolve(res);
        })
        .catch(error => {
          reject(error);
        });
      })
    },
    getCategoryList(data:any){
      return new Promise((resolve, reject) => {
        categoryList()
        .then(res => {
          resolve(res);
        })
        .catch(error => {
          reject(error);
        });
      })
    }
  }
});
export default useProductStore;





